package io.hxci.modules.edu.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import io.hxci.common.annotation.DataFilter;
import io.hxci.common.utils.Constant;
import io.hxci.common.utils.PageUtils;
import io.hxci.common.utils.Query;
import io.hxci.modules.edu.domain.EduSign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.*;
import java.util.stream.Collectors;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.hxci.modules.edu.dao.EduCourseMapper;
import io.hxci.modules.edu.domain.EduCourse;
import io.hxci.modules.edu.service.EduCourseService;
@Service
public class EduCourseServiceImpl extends ServiceImpl<EduCourseMapper, EduCourse> implements EduCourseService{

    @Autowired
    EduCourseMapper eduCourseMapper;
    @Override

    public PageUtils queryPage(Map<String, Object> params, Long userId) {
        IPage<EduCourse> page = new Query<EduCourse>().getPage(params);

        page.setRecords(this.baseMapper.queryPage(page,userId));
        return new PageUtils(page);
    }

    @Override
    public PageUtils queryPageInfo(Map<String, Object> params, Long userId) {
        IPage<EduCourse> page = new Query<EduCourse>().getPage(params);

        page.setRecords(this.baseMapper.queryPageInfo(page,userId));
        return new PageUtils(page);
    }

    @Override
    public List<EduSign> check(String recordid) {
        return eduCourseMapper.check(recordid);
    }

    @Override
    public void change(EduSign eduSign) {
        eduCourseMapper.change(eduSign);
    }

    @Override
    public Integer count(EduSign eduSign) {
        return eduCourseMapper.count(eduSign);
    }


//    public PageUtils attendance(Map<String, Object> params, Long userId) {
//        IPage<EduSign> page = new Query<EduSign>().getPage(params);
//       List<EduSign> list = this.baseMapper.attendance(page,userId);
//        List<EduSign> unique = list.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(EduSign::getSname))), ArrayList::new));
//
//        page.setRecords(unique);
//        return new PageUtils(page);
//    }


}
